/**依赖
 * ref=tree
 */
import _ from 'lodash'
export default {
	data() {
		return {
			//节点过滤
			queryTree:'',
			//备选
			candidates:[]
		}
	},
	watch: {
		queryTree(n,o) {
			this.$refs.tree.filter(n);
		}
	},
	methods:{
		filterMangerNode(v, d){
			return !v ? true : d.title.indexOf(v) !== -1
		},
		handleCheck(data,attrs){
			this.candidates = this.$refs.tree.getCheckedNodes(true)
		},
		//删除备选
		handleClose(tag){
			this.candidates.splice(_.findIndex(this.candidates,tag),1)
			this.$refs.tree.setChecked(tag)
		},
		//清空选择
		handleClear(){
			this.candidates = []
			this.$refs.tree.setCheckedKeys([])
		},
	}
}